package com.example.xyh.Controller;

import com.example.xyh.service.ShopService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
@RequestMapping
@Tag(name = "Shop", description = "ShopController")
public class ShopController {
    @Resource
    ShopService shopService;

    @Autowired
    public ShopController(ShopService shopService) {
        this.shopService = shopService;
    }


    @PostMapping("/AllShopList")
    public List<com.example.xyh.dto.ShopDto> AllShopList() {
        return shopService.getAllShopList();
    }


    @PostMapping("/BusinessShopList")
    public List<com.example.xyh.dto.ShopDto> BusinessShopList(Integer business_id) {
        return shopService.findShopsByBusinessIdAndIsDeletedIsNull(business_id);
    }


    @PostMapping("/AddShop")
    public com.example.xyh.dto.ShopDto addShop(Integer business_id, String shop_name) {
        return shopService.addShop(business_id, shop_name);
    }

    @PostMapping("/DeleteShop")
    public com.example.xyh.dto.ShopDto deleteShop(String shop_name) {
        return shopService.deleteShop(shop_name);
    }
}
